package com.code.leetcode.before50;

/**
 * @author codeDorado
 * @version 1.0
 * @date 2020/7/23 11:08
 */
public class The53 {
    public int maxSubArray(int[] nums) {
        int sum = 0;
        int rtn = nums[0];
        for (int num : nums) {
            if (sum > 0) sum += num;
            else sum = num;
            rtn = Math.max(sum, rtn);
        }
        return rtn;
    }
}
